package com.cherrish.demo.framework;

import com.cherrish.demo.protocol.dubbo.DubboProtocol;
import com.cherrish.demo.protocol.http.HttpProtocol;

/**
 * @author cherrish
 * @time 2019-03-20 17:44
 * @name ProtocolFactory
 * @desc:
 */
public class ProtocolFactory {
    public static Protocol getProtocol(){
        String name = System.getProperty("protocol");
        if(null == name || "".equals(name.trim())){
            name = "http";
        }
        switch (name){
            case "http":
                return new HttpProtocol();
            case "dubbo":
                return new DubboProtocol();
            default:
                break;
        }
        return new HttpProtocol();
    }
}
